package logger

import (
	"log"
	"os"
	"workflow/config"
)

var Logger *log.Logger
var LogFile *os.File

func init() {
	LogFile, err := os.OpenFile(config.Config.LogFile, os.O_APPEND|os.O_CREATE|os.O_RDWR, os.ModeAppend|os.ModePerm)
	if err != nil {
		panic(err)
	}
	Logger = log.New(LogFile, "", log.LstdFlags|log.Lshortfile)
}

func Close() {
	LogFile.Close()
}
